<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>菜单管理页面</title>
<script type="text/javascript" src="<c:url value='/admin/js/util/jquery-1.8.1.min.js' />" ></script>
<script type="text/javascript" src="<c:url value='/admin/js/util/validate.js' />" ></script>
<link href="<c:url value='/admin/css/general.css' />" rel="stylesheet" type="text/css" />
<script language="javascript">
function addCustomers(o,a,b){ 
	var t=document.getElementById(o).getElementsByTagName("tr"); 
	for(var i=0;i<t.length;i++){ 
		t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b; 
		t[i].onmouseout=function(){ 
			if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b; 
		};
	}
}
	
function returnMain() {
	document.location.href = "<c:url value='/admin/menuAction!flush.do' />";
}

function submitForm() {
	if (validate()) {
		$("#mainForm").attr("action", "<c:url value='/admin/menuAction!createSubExc.do' />");
		$("#mainForm").submit();
	}
}

function validate() {
	if (!validateLength("menuName",1,40,"请输入菜单标题","菜单标题过长"))
		return false;
	if (!validateLength("menuUrl",1,100,"请输入菜单定位","菜单定位过长"))
		return false;
	if ($("#menuOrderNum").val != "")
		if (!maxValue("menuOrderNum",10000,"请输入小一点的排序号"))
			return false;
	if (!validateLength("menuRemark",0,400,"","请输入短一点的菜单说明"))
		return false;
	return true;
}
</script>
</head>
<body>
	<form id="mainForm" action="" method="post">
		<input type="hidden" name="menu.parentId" value="${ menu.id }" />
		<div class="tableTitle">添加下级菜单</div>
		<table width="100%" cellspacing="1" id="addCustomers">
			<tr>
				<th colspan="2">注：带<b>*</b>号的为必填项
				</th>
			</tr>
			<tr>
				<td><span>上级菜单：</span><input name="" type="text" disabled="disabled" value="${ menu.name }"/></td>
			</tr>
			<tr>
				<td><span>菜单级别<b>*</b>：</span><input name="menu.menuType" id="menuType" type="text" readonly="readonly" value="${ menu.menuType + 1 }"/>
				</td>
			</tr>
			<tr>
				<td><span>菜单标题<b>*</b>：</span><input name="menu.name" id="menuName" type="text" maxlength="40"/></td>
			</tr>
			<tr>
				<td><span>菜单定位<b>*</b>：</span><input name="menu.url" id="menuUrl" maxlength="100"></input></td>
			</tr>
			<tr>
				<td><span>排序号：</span><input name="menu.orderNum" id="menuOrderNum" maxlength="4"></input></td>
			</tr>
			<tr>
				<td><span>菜单说明：</span><textarea name="menu.remark" id="menuRemark"></textarea></td>
			</tr>
			<tr>
				<td><a href="javascript:submitForm();">保存</a> <a href="javascript:document.getElementById('mainForm').reset();">重置</a> <a
					href="javascript:returnMain();">返回</a></td>
			</tr>
		</table>
	</form>
	<script language="javascript">
	//addCustomers("表格名称","奇数行背景","偶数行背景","鼠标经过背景","点击后背景"); 
	addCustomers("addCustomers","#fff","#F6F6F6");
	</script>
</body>
</html>